The present invention relates to a method for representing a digital image of a bar code or matrix code in a vector format, that automatically adjusts its critical dimensions to correctly match the dot spacings of different printers and that allows various graphical parameters of the bar code image to be safely changed after the image is encoded.
Ever since the 1960""s, and especially since the advent of the Universal Product Code in the 1970""s, bar code symbols have been widely adopted as the most popular form of optical marking for machine recognition of printed information. It has proved to be substantially more reliable than Optical Character Recognition (OCR) technology, primarily because (unlike printed letters and numbers) the bar-and-space xe2x80x9clanguagesxe2x80x9d represented in bar codes were designed xe2x80x9cfrom the ground upxe2x80x9d to be easily discriminated by machine, even in the presence of some degree of printing and scanning defects. Several barcode xe2x80x9clanguages,xe2x80x9d called xe2x80x9csymbologiesxe2x80x9d have been developed, each with its advantages for certain applications. One characteristic that they all have in common, is that the bars and spaces are varied in their widths, to form predefined patterns that actually carry the information. Moreover, these widths are not continuously variable (like the set of real numbers). Instead, they are quantized into a small set of allowed nominal widths, measurably different from each other, so that the reading machine (i.e. scanner) can pick the nearest ideal width which is the best fit to the imprecise signals that are received when light is reflected from an imperfectly-printed symbol. It is very important that the reading system can unequivocally determine which widths were intended to be printed. A single mistake in this regard will result in failure to decode the barcode, and worse, multiple mistakes can result in an erroneous interpretation of the encoded data.
Although not all bar code symbologies use the same set of allowed widths (nor would that restriction apply to the current invention), it is simplest for explanatory purposes to consider a typical class of bar code symbologies called (n,k) codes, where the bar code is typically constructed of a series of patterns, each pattern usually representing one or two data characters, and each pattern made up of a small number of bars and spaces of predefined relative widths. For example, in barcodes of the Code 128 symbology, each of these bars and each of these spaces must be chosen from one of four relative widths. The unit width (by definition, the narrowest bar or space allowed) is called a module. All of the bars and all of the spaces within a Code 128 symbol are nominally either 1, 2, 3, or 4 modules wide; no other widths are defined. The absolute width of a module is not a fixed dimension across all Code 128 symbols, but can be chosen at the time of printing. The typical width of a printed module ranges from 0.005 inch to 0.040 inch (but is fixed at one size, within any one printed symbol). Other symbologies, such as Code 39, utilize only two different allowed widths (xe2x80x9cwidexe2x80x9d and xe2x80x9cnarrowxe2x80x9d) for the bars and spaces. The wide elements are not necessarily an integer multiple of the narrow elements (for example, the wide bars and spaces can be chosen to be 2.5 times the width of the narrow bars and spaces). One skilled in the art would recognize that such symbologies can also benefit from the techniques of the present invention.
Since the typical bar code reading device can operate over a wide range of distances from the bar coded paper or package, the decode algorithms in the reader do not attempt to estimate the actual sizes of the bars and spaces (they will appear smaller, the further the reader gets from the paper). Instead, the decode algorithms attempt to judge the relative (not absolute) widths of these elements. As an example, the Code 128 symbology uses a set of 108 different patterns, and each pattern is comprised of three bars and three interleaved spaces which always have a total width (across those six elements) of eleven modules. Thus, the decode algorithm (in greatly simplified form) can look at a group of three bar and three space measurements from the scanner, calculate that total width, assume that this represents eleven modules, and then judge whether each bar or space is closest to {fraction (1/11)}, {fraction (2/11)}, {fraction (3/11)}, or {fraction (4/11)} of that total width. In actuality, the decode algorithm estimates the widths of adjacent bar/space pairs, rather than single bars or spaces, because this approach is more immune to a phenomenon called uniform ink spread. It can be seen that the actual size of a printed module is irrelevant to the decoder, but the relative widths must be fairly close to the ideal ratios of 1:2:3:4. Some error is tolerated, because if a bar whose nominal width was 3 modules is accidentally printed as 3.25 modules, the decoder will still correctly round-off to the nearest allowed width of 3. Should that error exceed half a module, on the other hand, a reading failure will occur. This error tolerance must be shared between printing inaccuracies and scanning signal inaccuracies (the scanner may be too far away and somewhat out of focus, for example). Thus, the more accurately the relative widths of the bar code are printed, the more likely the system will still work despite a poor scanner signal (due to operator error, electrical or optical noise, or other factors).
Naturally, it is usually desired for bar codes to be printed in as small an area as is possible (for instance, to leave more room for other graphics and text). This is done by printing at the smallest nominal module size that is still within the capabilities of the printer to print accurately, and within the capabilities of the scanner to scan accurately. From the printing perspective, the lower limit on printed module size is somewhat dependent on the roughness of the paper and characteristics of the ink, but it depends primarily on the dot spacing of the printing device. The narrowest bar that any printer can print is, by definition, one dot wide, but the width of a single column of dots varies too much to be an accurate unit width. The standard rule of thumb is that the unit module width must be at least two dots wide, and a minimum of three dots wide is recommended. Since different printers have different dot spaces (commonly measured in dots per inch or DPI), a three-dot-wide unit module will be different physical sizes on different printers. The printing technologies that print bar codes vary by more than an order of magnitude in their DPI resolution, from 200 DPI (inexpensive thermal printers that generate small labels) to 4000 DPI (high-resolution printing presses for magazines and other high-quality print jobs).
The foregoing discussion indicates why, in the current state of the art, it has always been important to ascertain the intended printing resolution before generating a digital bar code image. This is because no printer can place a dot half way between the imaginary grid points that define that printer""s dot pitch. If, for example, a bar code will be printed on a 300 DPI printer (typical of many ink jet and laser printers), a three-dot-wide bar will be nominally {fraction (3/300)} of an inch wide (i.e., {fraction (1/100)}, or 0.010 inch). A four-dot-wide bar will be 0.0133 inch wide, and a five-dot-wide bar will be 0.0167 inch wide. Note, however, that a 0.015 inch width cannot be accurately printed on a 300 dpi printer, because that width xe2x80x9cfalls between the dotsxe2x80x9d of the printer""s imaginary grid. A 400 dpi printer can accurately print that width in 6 dots, and a 600 dpi printer can do it accurately in 9 dots, but the image of a barcode with a 0.015 module width will inevitably be rendered quite inaccurately if sent to a 300 dpi printer. In fact, the widths of the narrow bars will (usually randomly) be a mix of 0.0133 and 0.0167 inch wide (but none can be 0.015), and the larger bars and spaces will be similarly xe2x80x9coffxe2x80x9d by plus or minus half a dot or more. This problem can be magnified by the relative-measurement approach of the decode algorithm. For example, a given interior measurement (a bar/space pair) could be almost 2 dots too narrow (if the left edge is moved to the right, and the right edge is moved to the left), while the overall character-pattern width could be almost 2 dots too wide, making the relative size of the interior measurement even more narrow (and most likely, causing a decoding failure).
For this reason, competent bar code generation programs (called xe2x80x9cencodersxe2x80x9d) have always required, as an input to the process, the expected printer resolution in dpi. In fact, these programs most often prohibit selection of a nominal module width that cannot be accurately matched to the dot pitch of the printer (in the above example, if 300 dpi were selected, then a nominal module width of 0.015 inch would not be an allowed choice).
Unfortunately, once a bar code image has been generated for one printer resolution, nothing prevents that image from being embedded in a larger document and eventually sent (out of ignorance or carelessness) to a printer of an incompatible resolution. No matter how accurate the original image was, for the intended printer, this image will make an inaccurate barcode on a printer whose dot pitch cannot exactly reproduce the intended dimensions. Especially when a bar code is added to an advertisement for a newspaper or magazine, it would be inherently difficult for the advertising agency to produce different versions of that ad to match the different printing presses used by different publishers who will incorporate that ad in their publications. Most likely, the same ad copy will find its way to all the printing presses, and the resulting bar code will be somewhat inaccurate on most of them.
It should be noted that an equivalent problem occurs when printing a two-dimensional matrix code to a printer at a mismatched resolution. In the case of a matrix code, the data is encoded in regular polygons (squares, rectangles, hexagons, or even round dots), where a polygon""s area is either printed or left unprinted to represent one bit of information at the graphical level. These codes are scanned by readers that form a two-dimensional image and then decode that image by determining the overall relative scale of the matrix code from non-data patterns that are predetermined features of the code, then determining the ideal locations of the data polygons within the image, and then determining if each such location was printed or unprinted. In this case, accurate placement of the predetermined features, and of the individual data polygons, is important. If the matrix code""s polygon-placement grid cannot be mapped to an integer number of printer dots, then errors in the centering of these polygons will occur, to the detriment of reading performance.
It is a common misconception that representing a bar code or matrix code image using a vector format, rather than a bitmap format, automatically solves this problem. In publishing, individual machine-generated images (including line art, and bar codes as well) are usually represented in vector format. As one example, Hewlett-Packard (HP) has developed a vector-graphics language called PCL, which is how a PC can translate a document into a set of drawing commands for an HP printer. Another popular vector image file format has been devised by Adobe, known as Encapsulated PostScript Format (or EPSF). This format can represent images as a series of primitive drawing commands, drawing a line between two points, or filling a circle or xe2x80x9cpaintingxe2x80x9d text characters on an imaginary page grid of infinite resolution. However, when a set of xe2x80x9cdrawing instructionsxe2x80x9d is executed for a specific printer, the resulting physically-inked points are still limited to the dot spacing of that printer. Thus a vector command to draw a rectangle 0.015 inch wide will still result in an inaccurate bar, if sent to a 300 dpi printer.
It is believed that all available bar code generation programs generate vector image files that, once embedded in a larger document, can be arbitrarily scaled and distorted at will by the operator of a word processor or page-layout program. This usually results in a mismatch between bar code dimensions and printer dot pitch, and can also result in a bar code that may be either too small or too large for a scanner to read.
It is also believed that all available bar code generation programs generate a vector image file that, when sent to a printer of an inappropriate dot pitch, will be rendered as a bar code with the correct overall (end-to-end) width, but where many of the individual bars and spaces will be either too wide or too narrow compared to nominal dimensions. This can result in a bar code that does not scan or scans incorrectly.
The printing problems described above are in general due to a mismatch between the ideal dimensions of a bar code and the dot pitch of the printer. These problems are often exacerbated by intentional or accidental scaling of the bar code image, once it has been embedded in a word processing file or a page-layout file. The user of the page-layout program is often tempted to xe2x80x9cstretchxe2x80x9d or xe2x80x9cshrinkxe2x80x9d the bar code image to make it fit better on the page. Although this is a useful operation when applied to a typical pictorial image, it is very likely to result in bar code dimensions that do not match the dot pitch of the printer, even if the image was a correct match when originally created.
It is an object of the present invention to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which can be rendered accurately on printers of any dot pitch.
It is another object of the present invention to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, so that an accurate digital image can be created without advance knowledge of the dot spacing of the printer that will be used to print the image.
It is a further object of the present invention to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the width of the nominal module size of the barcode depicted in the image to be an integer number of dots.
Another object of the present invention is to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the width of the nominal module size of the barcode depicted in the image to be an appropriate number of dots, taking a possible rotation of the image into account.
A further object of the present invention is to provide an improved method for representing a vector-graphic image of a linear machine-readable symbol, which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the height of the bars of the barcode depicted in the image to be an integer number of dots.
A still further object of the present invention is to provide an improved method for representing a vector-graphic image of a xe2x80x9cstackedxe2x80x9d two-dimensional machine-readable symbol (such as PDF417), which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the height of each row of bars of the barcode depicted in the image to be an integer number of dots.
Still another object of the present invention is to provide an improved method for representing a vector-graphic image of a xe2x80x9cmatrixxe2x80x9d two-dimensional machine-readable symbol (such as Data Matrix), which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the height of the modules of the barcode depicted in the image to be an integer number of dots.
Another object of the present invention is to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which, when this image is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the amount of print-gain compensation (in either the X or Y dimension, or both) in the barcode depicted in the image to be an integer number of dots.
An object of the present invention is to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which (once embedded in a larger document file) can control the extent to which the printed image may be scaled, and when this document is sent to a printer or to a Raster Image Processor for rendering at a specific dot pitch, automatically adjusts the width of each of the critical parameters of the scaled image (such as nominal module width and height, and amount of print-gain compensation) to be an integer number of dots.
It is another object of the present invention to provide an improved method for representing a vector-graphic image of a linear or two-dimensional machine-readable symbol, which allows a user to safely alter various graphical parameters of the image, without needing to re-encode the symbol, and without needing access to a program that is capable of encoding symbols of the represented symbology.
Many industrial-use printers (available from vendors such as Zebra and Intermec) contain their own bar code generation algorithms. Since the bar code generation is inherently performed for a single printer resolution, these printers are not relevant to the current invention. Numerous commercial software programs are currently being marketed that can generate a digital image of a barcode for an external printer. Sometimes the bar code encoding function is part of a label-generation package, such as CodeSoft, from Teklynx. When adding a bar code image to a CodeSoft label, the CodeSoft program requires, as input, how many printer dots should make up a narrow bar. Once set, this value can only be changed by re-entering the program, and cannot be varied automatically if the same label file is sent to a different printer. Thus, such a program does not achieve the goals of the present invention. Other programs can output bar code images in a wide variety of bitmapped file formats (creating files with .bmp and .tif extensions, for example) and vector-graphic file formats (creating files with .eps extensions, for example). One example is the program called Bar Code Pro, from SNX (formerly Synex, of Brooklyn, N.Y.). This program operates by taking a specified printer dpi as input, and then provides a list of only the nominal module sizes that are accurately supported by that dpi. However, when the resulting eps graphics file is printed on a printer of lower resolution, the result is an image that is the correct overall size, but where the individual bars and spaces are randomly too large or small, due to round-off error in translating from an ideal width to an integer number of dots.
These and other objects of the present invention are achieved by a method according to the present invention for producing a digital image of a machine readable optical code symbol having areas of different spectral characteristics and which is printable on differing printers having differing dot pitches in which the code symbol is represented in a format that automatically causes the RIP to reduce the overall width if necessary, so that nominal module width becomes an exact integer number of dots wide for each printer used, without any modification to the image file itself, nor to the document file containing the image.
In one embodiment of a method according to the invention, a desired nominal unit dimension for each area of the optical code symbol is selected, a resulting nominal unit dimension for each area is defmed as a function of the dot pitch of a target printer; and a vector representation of the optical code symbol using the resulting nominal unit dimension is provided.
In another embodiment of the invention, the method also includes selecting a desired nominal starting position for each successive area of the optical code symbol, defining a resulting nominal starting position for each successive area as a function of the dot pitch of a target printer; and providing a vector representation of the optical code symbol using the resulting nominal unit dimension and the resulting nominal starting positions.
In a further embodiment of the present invention, the method of producing a digital image of a machine readable optical code symbol having areas of different spectral characteristics and which is printable on differing printers having differing dot pitches, comprises selecting a desired nominal starting position for each successive area of the optical code symbol, defining a resulting nominal starting position for each successive area as a function of the dot pitch of a target printer and providing a vector representation of the optical code symbol using the resulting nominal starting positions.
In each of the embodiments, preferably, the optical code symbol is a bar code having bars and spaces of varying widths and more preferably the bar code is an n,k bar code and wherein the nominal unit dimension is a module width and in a particularly advantageous commercial embodiment, the n,k bar code is an 11,3 bar code wherein the bars and spaces are from 1 to 4 modules in length. Alternatively, the code symbol can be a two-dimensional code symbol, preferably an n,k bar code and wherein the nominal unit dimension is at least one of the X dimension and the Y dimension and most preferably PDF417.
The code symbol image file can be embedded into another electronic document. Controls can be included in the image file to limit the scaling of the image to predefined limits, to specify an amount print gain adjustment to be applied to compensate for ink spread, and to specify an amount of unprinted border area adjacent to the code symbol when printed.